[contents] [prev] [next] [top] [bottom] (10 out of 17)

Operator Precedence

Table 2-3 summarizes the precedence of ScriptX operators and expressions. Operators higher up the table are evaluated first if they occur side-by-side in an expression. Operators in the same table cell have equal precedence and are evaluated from left to right, unless otherwise stated.

Table 2-3: ScriptX operator precedence, highest to lowest

Operator (s)

Notes

collection[key]

element access in collections, described on page 50

object.variable

class and instance variable access, described in Chapter 3

function arg arg . . .
function (arg, arg, . . .)

function calls, described in Chapter 3

object as class

object coercion, described in Chapter 3

-

negation, described on page 42

* /

multiplication, division, described on page 42

+ -

addition, subtraction, described on page 42

= == <> != !==
> < >= <=

contains

equality and magnitude, described on page 43.
contains is used for collection membership, described on page 52

not

logical not, described on page 47.

and

logical and, described on page 47

or

logical or, described on page 47.

in
by

for expressions
association is from right to left.

|

pipe operator, described in Chapter 5

repeat
guard

exit
for
return

loops and block control expressions are described in Chapter 4, while the guard expression is described in Chapter 8.

&

thread operator, described in Chapter 5

location := value

assignment operator, described on page 38

You can change the order of evaluation by surrounding expressions with parentheses. ScriptX evaluates the innermost expressions first:

(((3 + 15) * 2) == 36)
(3 < 4) and (5 >= 2)

For additional information on operators and expression syntax, see Appendix A, "ScriptX Reference."


This document is part of the ScriptX Language Guide, one of the volumes of the ScriptX Technical Reference Series. ScriptX is developed by the ScriptX Engineering Team at Apple Computer, successor to the Kaleida Engineering Team at Kaleida Labs, Inc.

Copyright 1996 Apple Computer, Inc. All Rights Reserved.